<?php
/**
 * @Author: xuzhiyi
 * @Date:   2016-02-16 20:57:17
 * @Last Modified by:   xuzhiyi
 * @Last Modified time: 2016-02-23 20:53:33
 * ------------------------------------------------ *
 * 银行管理                                          *
 * ------------------------------------------------ */
namespace Admin\Model;


class BanksModel extends CommonModel{
	/* 添加银行
	 *--------------------------*/
	 public function addBanks(){
		$data = array();
		$data["bankName"] = I("bankName");
		$data["bankFlag"] = 1;
	    if($this->checkEmpty($data)){
			$u = M('banks');
			$rs = $u->add($data);
			if(false !== $rs){
				return true;
			}
		}
		return false;
	}

	//删除银行
	 public function delBanks(){
	 	$bankId = (int)I('bankId');
	 	$a = M('banks');
	 	$data['bankFlag']=-1;
	    $rs = $a->where("bankId=".$bankId)->save($data);
		if(false !== $rs){
			return true;
		}
		return false;
	 }

	 
	 /* 修改银行
	 *--------------------------*/
	 public function editBanks(){
	 	$bankId = (int)I("bankId",0);
		$data = array();
		$data["bankName"] = I("bankName");

	    if($this->checkEmpty($data)){
			$rs = M('banks')->where("bankId=".$bankId)->save($data);
			if(false !== $rs){
				return true;
			}
		}
		return false;
	}


	/* 获取银行列表
	 *--------------------------*/
	 public function getBanks(){
		$rs = M('banks')->where("bankFlag=1")->select();
		if(false !== $rs){
			return $rs;
		}
		
		return false;
	}
    
}